package com.amit.struts;

import java.util.Locale;


import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import org.apache.struts.Globals;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.DynaActionForm;

public class SearchAction extends Action {
	
	
	@Override
	public ActionForward execute(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response)
			throws Exception {
		
		DynaActionForm df=(DynaActionForm)form;
		String h=df.get("hello").toString();
		System.out.println(h);
		
		HttpSession hs=request.getSession();
		Locale lo=(Locale) hs.getAttribute(Globals.LOCALE_KEY);
		
		System.out.println("current locale is"+lo.getLanguage());
		
		return mapping.findForward("results");
	}

}
